﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TaobaoERP.Core.Common;

namespace TaobaoERP.BusinessTaobao.ParObject
{
    /// <summary>
    /// taobao.item.get
    /// 此接口方法用以得到单个商品信息。
    ///注意该api的调用级别,如果需要获取隐私信息(包括商品的隐私字段和仓库内商品),则需附上sip_sessionid.
    ///注：因为业务规则的原因，部分用户的少量商品，无法通过此接口获取
    /// </summary>
    public class ItemPar:ParBase
    {
        [Par(IsNeed = true)]
        public string sip_apiname = "taobao.item.get";

        [Par(IsNeed = true)]
        public string fields = "iid,title,nick,type,cid";

        /// <summary>
        /// 卖家昵称
        /// </summary>
        [Par(IsNeed = true)]
        public string nick;

        /// <summary>
        /// 商品ID
        /// </summary>
        [Par(IsNeed = true)]
        public int iid;
    }

    /// <summary>
    /// taobao.items.onsale.get
    /// 出售中商品列表
    /// </summary>
    public class OnSaleListPar : ParBase
    {
        [Par(IsNeed = true)]
        public string sip_apiname = "taobao.items.onsale.get";

        [Par(IsNeed = true)]
        public string fields = "iid,title,nick,type,cid";

        [Par(IsNeed = true)]
        public string sip_sessionid = Utils.GetCookies("sessionid");

        public int page_no;
        public int page_size;
        /// <summary>
        /// 是否参与会员折扣
        /// </summary>
        public bool has_discount;
        /// <summary>
        /// 是否橱窗推荐
        /// </summary>
        public bool has_showcase;
    }

    /// <summary>
    /// aobao.items.instock.get
    /// 获得库存商品。支持分页。
    /// </summary>
    public class InStockListPar : ParBase
    {
        [Par(IsNeed = true)]
        public string sip_apiname = "taobao.items.instock.get";

        public string fields = "iid,title,nick,type,cid";
        public int page_no;
        public int page_size;
        /// <summary>
        /// 分类字段没卖出的:unsold; 
        /// 部分卖出的:partly_sold; 
        /// 定时上架:regular_shelved; 
        /// 从未上架:never_on_shelf; 
        /// 全部卖完:sold_out; 
        /// 我下架的:off_shelf; 
        /// 等待所有上架:for_shelved 
        /// </summary>
        public string banner;
    }

    /// <summary>
    /// taobao.item.add 功能参数
    /// </summary>
    public class ItemAddPar : ParBase
    {
        [Par(IsNeed = true)]
        public string sip_apiname = "taobao.item.add";

        /// <summary>
        /// 商品上传后的状态。onsale出售中，instock库中
        /// </summary>
        [Par(IsNeed = true)]
        public string approve_status;
        /// <summary>
        /// 叶子类目id
        /// </summary>
        [Par(IsNeed = true)]
        public int cid;
        /// <summary>
        /// 绑定属性列表
        /// </summary>
        public string props;
        /// <summary>
        /// 商品数量
        /// </summary>
        [Par(IsNeed = true)]
        public int num;
        /// <summary>
        /// 商品价格
        /// </summary>
        [Par(IsNeed = true)]
        public decimal price;
        /// <summary>
        /// 发布类型,fixed(一口价),auction(拍卖),bulk(团购)
        /// </summary>
        [Par(IsNeed = true)]
        public string type;
        /// <summary>
        /// 新旧程度,new(新),second(二手),unused(闲置)
        /// </summary>
        [Par(IsNeed = true)]
        public string stuff_status;
        /// <summary>
        /// 商品标题
        /// </summary>
        [Par(IsNeed = true)]
        public string title;
        /// <summary>
        /// 商品描述
        /// </summary>
        [Par(IsNeed = true)]
        public string desc;
        /// <summary>
        /// 所在地省份,如浙江
        /// </summary>
        [Par(IsNeed = true)]
        public string locationDOTstate;
        /// <summary>
        /// 所在地城市,如杭州
        /// </summary>
        [Par(IsNeed = true)]
        public string locationDOTcity;
        /// <summary>
        /// 运费承担方式,seller（卖家承担），buyer(买家承担）。默认seller。
        /// </summary>
        public string freight_payer;
        /// <summary>
        /// 有效期天数,7或者14
        /// </summary>
        public int valid_thru;
        /// <summary>
        /// 是否有发票,true/false。默认false。
        /// </summary>
        public bool has_invoice;
        /// <summary>
        /// 是否保修,true/false。默认false。
        /// </summary>
        public bool has_warranty;
        /// <summary>
        /// 店铺类目列表,按逗号分隔
        /// </summary>
        public string seller_cids;
        /// <summary>
        /// 是否支持会员打折,true/false
        /// </summary>
        public bool has_discount;
        /// <summary>
        /// 平邮费用,如5.00
        /// </summary>
        public decimal post_fee;
        /// <summary>
        /// 快递费用,如15.00
        /// </summary>
        public decimal express_fee;
        /// <summary>
        /// 上架时间,2008-05-26 09:12:00
        /// </summary>
        public DateTime list_time;
        /// <summary>
        /// 拍卖的加价幅度
        /// </summary>
        public decimal increment;
        /// <summary>
        /// 自动上架,true/false
        /// </summary>
        public bool auto_repost;
        /// <summary>
        /// 橱窗推荐,true/false
        /// </summary>
        public bool has_showcase;
        /// <summary>
        /// ems费用,如25.00
        /// </summary>
        public decimal ems_fee;
        /// <summary>
        /// 商品图片
        /// </summary>
        public byte[] image;
    }
}
